package com.itheima.blog.article.controller;

import com.itheima.blog.article.entity.TBlog;
import com.itheima.blog.article.service.MyBlogService;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/owner")
@AllArgsConstructor
public class MyBlogControllers {
    private final MyBlogService myBlogService;

    @PutMapping("/blog/{blogId}")
    public void updateMyBlog(@RequestBody TBlog tBlog){
        myBlogService.updateMyBlog(tBlog);

    }
    @DeleteMapping("/blog/{blogId}")
    public void deleteMyBlog(TBlog tBlog){
        myBlogService.deleteMyBlog(tBlog);
    }
    @ApiOperation("设置是否开启评论")
    @PutMapping("/blog/commentset")
    public void onOff(@RequestBody TBlog tBlog){
        myBlogService.onOff(tBlog);
    }
    @ApiOperation("按照用户ID查询所需图片")
    @GetMapping("/album/user")
    public List<String> findImageById(Long id){
       return myBlogService.findImageById(id);

    }
    @ApiOperation("文章上架下架")
    @PutMapping("/blog/publish")
    public void shangXia(TBlog tBlog){

        myBlogService.shangXia(tBlog);
    }


}
